﻿<navigation:Page x:Class="ADministration.Views.Events" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Events Page" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:ADministration.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot">
        <toolkit:BusyIndicator Name="busyIndicator">
            <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">

                <StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">

                    <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                           Text="{Binding Path=Strings.EventsPageTitle, Source={StaticResource ApplicationResources}}"/>
                    <Grid>
                        <riaControls:DomainDataSource AutoLoad="True" 
                                                  d:DesignData="{d:DesignInstance my:Event, CreateList=true}"
                                                  LoadedData="eventDomainDataSource_LoadedData" 
                                                  Name="eventDomainDataSource" QueryName="GetEventsQuery">
                            <riaControls:DomainDataSource.DomainContext>
                                <my:TicketsDomainContext />
                            </riaControls:DomainDataSource.DomainContext>
                        </riaControls:DomainDataSource>
                        <sdk:DataGrid AutoGenerateColumns="False" Height="200" IsReadOnly="True"
                                  ItemsSource="{Binding ElementName=eventDomainDataSource, Path=Data}" 
                                  x:Name="eventDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" 
                                  Width="Auto" MinWidth="500" Margin="6,0,152,0" 
                                  HorizontalAlignment="Left" VerticalAlignment="Top">
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn x:Name="eventIDColumn" 
                                                    Binding="{Binding Path=EventID, Mode=OneWay}" 
                                                    Header="Event ID" IsReadOnly="True" Width="Auto" />
                                <sdk:DataGridTextColumn x:Name="titleColumn" Width="Auto"
                                                    Binding="{Binding Path=Title}" Header="Title"/>
                                <sdk:DataGridTextColumn x:Name="locationColumn" Width="Auto"
                                                    Binding="{Binding Path=Location}" Header="Location"/>

                                <sdk:DataGridTextColumn x:Name="priceColumn" Width="Auto"
                                                    Binding="{Binding Path=Price}" Header="Price"/>
                                <sdk:DataGridTextColumn x:Name="currencyColumn" Width="Auto"
                                                    Binding="{Binding Path=Currency}" Header="Currency"/>
                                <sdk:DataGridTextColumn x:Name="categoryIDColumn" Width="Auto"
                                                    Binding="{Binding Path=CategoryID}" Header="Category ID" />

                                <sdk:DataGridTextColumn x:Name="categoryNameColumn" Width="Auto"
                                                    Binding="{Binding Path=Category.Name, Mode=TwoWay}" Header="Category Name" />

                            </sdk:DataGrid.Columns>
                        </sdk:DataGrid>
                    </Grid>

                    <!--<riaControls:DomainDataSource AutoLoad="True" 
                                                  d:DesignData="{d:DesignInstance my:Event, CreateList=true}"
                                                  LoadedData="categoryDomainDataSource_LoadedData" 
                                                  Name="categoriesDomainDataSource" QueryName="GetCategoriesQuery">
                        <riaControls:DomainDataSource.DomainContext>
                            <my:TicketsDomainContext />
                        </riaControls:DomainDataSource.DomainContext>
                    </riaControls:DomainDataSource>-->
                    <Grid x:Name="editEvent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="334*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <!--<TextBlock Grid.Row="0" Grid.Column="0" Text="Title: " />
                        <TextBox Grid.Row="0" Grid.Column="1" x:Name="textboxEventTitle"
                             Text="{Binding ElementName=eventDataGrid,Path=SelectedItem.Title, Mode=TwoWay, UpdateSourceTrigger=Default}"/>
                        <TextBlock Grid.Row="1" Grid.Column="0" Text="Location: " />
                        <TextBox Grid.Row="1" Grid.Column="1" x:Name="textboxEventLocation"
                             Text="{Binding ElementName=eventDataGrid,Path=SelectedItem.Location, Mode=TwoWay}"/>
                        <TextBlock Grid.Row="2" Grid.Column="0" Text="Price: " />
                        <TextBox Grid.Row="2" Grid.Column="1" x:Name="textboxEventPrice"
                             Text="{Binding ElementName=eventDataGrid,Path=SelectedItem.Price, Mode=TwoWay}"/>
                        <TextBlock Grid.Row="3" Grid.Column="0" Text="Currency: " />
                        <TextBox Grid.Row="3" Grid.Column="1" x:Name="textboxEventCurrency"
                             Text="{Binding ElementName=eventDataGrid,Path=SelectedItem.Currency, Mode=TwoWay}"/>
                        <TextBlock Grid.Row="4" Grid.Column="0" Text="Category Name: " />-->
                        
                        <!--<ComboBox Grid.Row="4" Grid.Column="1" Name="comboBoxEventCategory" MinWidth="120" Width="Auto"
                              SelectedItem="{Binding ElementName=eventDataGrid,Path=SelectedItem.Category, Mode=TwoWay}"
                              SelectedValuePath="CategoryID" DisplayMemberPath="Name" 
                              ></ComboBox>-->

                        <Button Grid.Row="5" Grid.Column="0" x:Name="buttonEditSaveChanges" Content="Save Changes" Click="buttonEditSaveChanges_Click" />
                        <Button Grid.Row="5" Grid.Column="1" x:Name="buttonEditCancel" Content="Cancel"/>
                        
                    </Grid>
                    <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:Category, CreateList=true}" Height="0" LoadedData="categoryDomainDataSource_LoadedData_1" Name="categoryDomainDataSource" QueryName="GetCategoriesQuery" Width="0">
                        <riaControls:DomainDataSource.DomainContext>
                            <my:TicketsDomainContext />
                        </riaControls:DomainDataSource.DomainContext>
                    </riaControls:DomainDataSource>
                    <ComboBox Height="23" 
                              ItemsSource="{Binding ElementName=categoryDomainDataSource, Path=Data}" 
                              Name="categoryComboBox" Width="120"
                              SelectedItem="{Binding ElementName=eventDataGrid, Path=SelectedItem.Category, Mode=TwoWay}"
                              DisplayMemberPath="Name">
                        <ComboBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel />
                            </ItemsPanelTemplate>
                        </ComboBox.ItemsPanel>
                    </ComboBox>
                </StackPanel>

            </ScrollViewer>
        </toolkit:BusyIndicator>
    </Grid>
</navigation:Page>
